package fr.utbm.gi.vi51.project.agent.body;

import java.net.URL;

import javax.swing.ImageIcon;

import org.arakhne.vmutil.Resources;
import org.janusproject.kernel.address.AgentAddress;

import fr.utbm.gi.vi51.project.agent.frustum.Frustum;
import fr.utbm.gi.vi51.project.gui.GUI;

public class MutaliskMissileBody extends ProjectileBody {

	private static final String normalSprite = "missile.png"; //$NON-NLS-1$
	private static final String attackSprite = "missile_explode.png"; //$NON-NLS-1$
	private static final double SIZE = 2;

	private static final double MAX_LINEAR_SPEED = 25;
	private static final double MAX_LINEAR_ACCELERATION = 2;
	private static final double MAX_ANGULAR_SPEED = Math.PI / 3;
	private static final double MAX_ANGULAR_ACCELERATION = Math.PI / 8;
	private static final int BASE_DAMAGE = 30;
	private static final int SIGHT_RANGE = 30;

	public MutaliskMissileBody(AgentAddress owner, double size, double maxLinearSpeed, double maxLinearAcceleration,
			double maxAngularSpeed, double maxAngularAcceleration) {
		super(owner, size, maxLinearSpeed, maxLinearAcceleration, maxAngularSpeed, maxAngularAcceleration);
	}

	public MutaliskMissileBody(AgentAddress owner) {
		this(owner, SIZE, MAX_LINEAR_SPEED, MAX_LINEAR_ACCELERATION, MAX_ANGULAR_SPEED, MAX_ANGULAR_ACCELERATION);

		URL url = Resources.getResource(GUI.class, normalSprite);
		this.normalIcon = new ImageIcon(url);
		url = Resources.getResource(GUI.class, attackSprite);
		this.attackIcon = new ImageIcon(url);
		this.currentIcon = this.normalIcon;

		this.damage = BASE_DAMAGE;
		this.frustum = new Frustum(SIGHT_RANGE, SIGHT_RANGE);
	}

}
